package com.campus.bbs;

import java.util.ArrayList;

import android.content.Context;
import android.renderscript.Type;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.LinearLayout;
import android.widget.LinearLayout.LayoutParams;
import android.widget.TextView;

public class TieAdapter extends BaseAdapter {
	public ArrayList<TieInfo> list;
	Context context;

	public TieAdapter(Context context, ArrayList<TieInfo> list) {
		this.list = list;
		this.context = context;
	}

	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return list.size();
	}

	@Override
	public Object getItem(int position) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		// TODO Auto-generated method stub
		LinearLayout view = new LinearLayout(context);
		view.setOrientation(LinearLayout.VERTICAL);
		TextView text = new TextView(context);
		LinearLayout.LayoutParams lp=new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,LinearLayout.LayoutParams.WRAP_CONTENT);
		lp.setMargins(10, 10,10,10);
		text.setTextSize(16);
		text.setText(list.get(position).title);
		TextView text2 = new TextView(context);
		text.setTextSize(10);
//		text2.setText(list.get(position).firstname + "  回复"
//				+ list.get(position).sum);\
		text2.setText(list.get(position).sencond);
		view.addView(text,lp);
		view.addView(text2,lp);

		return view;
	}

}
